﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace DmPlayer
{
    public class Dm
    {
        public string text { get; private set; }
        public string id { get; private set; }
        public string sender { get; private set; }
        public string position { get; private set; }
        public string font { get; private set; }
        public int color { get; private set; }
        public double size { get; private set; }
        public string time { get; private set; }
        public Dm(string text, string id, string sender, string position, string font, int color, double size, string time)
        {
            this.text = text;
            this.id = id;
            this.sender = sender;
            this.position = position;
            this.color = color;
            this.size = size;
            this.font = font;
            this.time = time;
        }

        public static Dm FromJson(JObject dmJson)
        {
            return new Dm((string)dmJson["text"],(string)dmJson["id"], (string)dmJson["sender"], (string)dmJson["position"], (string)dmJson["font"], (int)dmJson["color"], (double)dmJson["size"], (string)dmJson["time"]);
        }
    }
}
